package com.workcell.workdata.xthings.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author 廖博文
 * @Date 2022/11/30 14:01
 * @Description 硬件类型枚举
 */
@Getter
@AllArgsConstructor
public enum HardwareTypeEnum {

    OVER("0000", "无此类型",false),
    FLOW_METER("0001", "流量计",false),
    POWER_METER("0002", "智能电表",true),
    TV_BOX("0003", "电视盒子",false),
    SERIAL_DEVICE("0004", "串口设备",false),
	TIME_CLOCK("0005","打卡机",false),
	CAMERA("0006","摄像头",false),
	BELT_SCALES("0007","皮带秤",true),
	TEMPERATURE_HUMIDITY("0008","温湿度计",false),
	FREEZER("0009","冷冻机",false),
	HEAT_EXCHANGERS("0010","换热机",false),

	LEVEL_GAUGE("0011","液位计",true),
	VALVE("0012","阀门",false),
	NATURAL_GAS("0013","天然气",true),
	UPPER_COMPUTER("0014","上位机",false),
	SMART_TANKS("0016","智能罐体",false),
	ROTARY_KILN("0017","回转窑",true),
	WATER_METER("0018","法兰水表",true),
	VOICE_SYNTHESIS("0019", "语音合成播放", true),
	SOUND_LIGHT_ALARM("0020", "声光报警器", true);

	private final String code;
	private final String msg;
	private final Boolean isHasAddress;

	/**
	 * 根据值获取枚举
	 * @param code 类型
	 * @return 返回枚举
	 */
	public static HardwareTypeEnum getByCode(String code) {
		for (HardwareTypeEnum hardwareType : values()) {
			if (hardwareType.getCode().equals(code)) {
				//获取指定的枚举
				return hardwareType;
			}
		}
		return HardwareTypeEnum.OVER;
	}

}
